<template>
  <div>
    <h1>登录页面</h1>
    <p>账号<input type="text" v-model="form.username"></p>
    <p>密码<input type="text" v-model="form.password"></p>
    <button @click="add">确认</button>
  </div>
</template>

<script>
export default {
  name: "nlogin",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    add(){
      this.$axios.post("users/Nusers_API/",this.form)
        .then(i=>{
          if (i.data.code == 200){
            localStorage.setItem('userid',i.data.userid)
            this.$router.push({path:"/News"})
            alert(i.data.code)
          }
        })
    }
  }
}
</script>

<style scoped>

</style>
